package com.zg.message.web;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zg.common.core.R;
import com.zg.message.domain.req.MsgConfigAddReq;
import com.zg.message.domain.req.MsgConfigPageReq;
import com.zg.message.domain.vo.MsgConfigVo;
import com.zg.message.service.MsgConfigService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>Description: </p>
 *
 * @author zhanfeng.liang
 * @since 2025/5/22 10:54
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/message/config")
@Slf4j
@Api(tags = "消息配置管理")
public class MsgConfigController {
    private final MsgConfigService msgConfigService;

    @PostMapping("/page")
    public R page(@RequestBody MsgConfigPageReq pageReq) {
        Page<MsgConfigVo> page = msgConfigService.page(pageReq, MsgConfigVo.class);
        return R.success(page);
    }


    @PostMapping("/add")
    public R add(@RequestBody MsgConfigAddReq addReq) {
        msgConfigService.add(addReq);
        return R.success();
    }


    @PostMapping("/remove")
    public R remove(@RequestBody List<Long> ids) {
        msgConfigService.remove(ids);
        return R.success();
    }
}
